
import SwiftUI
import GRDB

struct DuetInteractionView: View {
    let row: Row
    let senderRow: Row?
    
    var body: some View {
        List {
            Group {
                row.dateCell(name: "Date", key: "ZSTARTDATE")
                row.numberCell(name: "Is Response", key: "ZISRESPONSE")
                row.cell(name: "Bundle ID", key: "ZBUNDLEID")
                row.cell(name: "Domian", key: "ZDOMAINIDENTIFIER")
                row.cell(name: "Group Name", key: "ZGROUPNAME")
            }
            if let senderRow = senderRow {
                Group {
                    senderRow.cell(name: "Sender Name", key: "ZDISPLAYNAME")
                    senderRow.cell(name: "Sender ID", key: "ZIDENTIFIER")
                    senderRow.cell(name: "Sender Custom ID", key: "ZCUSTOMIDENTIFIER")
                    senderRow.numberCell(name: "Incoming Recipient Count", key: "ZINCOMINGRECIPIENTCOUNT")
                    senderRow.numberCell(name: "Incoming Sender Count", key: "ZINCOMINGSENDERCOUNT")
                    senderRow.numberCell(name: "Outgoing Recipient Count", key: "ZOUTGOINGRECIPIENTCOUNT")
                    senderRow.dateCell(name: "Sender Creation Date", key: "ZCREATIONDATE")
                    senderRow.dateCell(name: "First Incoming Recipient Date", key: "ZFIRSTINCOMINGRECIPIENTDATE")
                }
                Group {
                    senderRow.dateCell(name: "First Incoming Sender Date", key: "ZFIRSTINCOMINGSENDERDATE")
                    senderRow.dateCell(name: "First Outgoing Recipient Date", key: "ZFIRSTOUTGOINGRECIPIENTDATE")
                    senderRow.dateCell(name: "Last Incoming Recipient Date", key: "ZLASTINCOMINGRECIPIENTDATE")
                    senderRow.dateCell(name: "Last Incoming Sender Date", key: "ZLASTINCOMINGSENDERDATE")
                    senderRow.dateCell(name: "Last Outgoing Recipient Date", key: "ZLASTOUTGOINGRECIPIENTDATE")
                    senderRow.dateCell(name: "Last Outgoing Recipient Date", key: "ZLASTOUTGOINGRECIPIENTDATE")
                }
            }
        }
    }
}

//struct DuetInteractionView_Previews: PreviewProvider {
//    static var previews: some View {
//        DuetInteractionView()
//    }
//}
